package be.ipl.finito.usecasesimpl;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Singleton;
import javax.ejb.Startup;

import be.ipl.finito.dao.JetonDao;
import be.ipl.finito.domaine.Jeton;
import be.ipl.finito.usecases.GestionJeton;

@Singleton
@Startup
public class GestionJetonImpl implements GestionJeton {

	@EJB JetonDao jetonDao;
	
	@Override
	public List<Jeton> initialiserJeton() {
		if(jetonDao.lister().size() == 0){
			return jetonDao.initialiser();
		}
		return null;
	}

	@Override
	public List<Jeton> listerJeton() {
		return jetonDao.lister();
	}

	@Override
	public Jeton getJeton(int numero) {
		return jetonDao.rechercher(numero);
	}
}